<template>
    <div class="home">
        <el-card class="welcome-card">
            <div slot="header">
                <span>欢迎页面</span>
            </div>
            <div class="welcome-content">
                <h3>欢迎访问系统</h3>
                <p>当前页面ID：{{ id || '未设置' }}</p>
                <el-button type="primary" @click="changeId">切换ID</el-button>
            </div>
        </el-card>
    </div>
</template>

<script>
export default {
    name: 'HomeView',
    props: {
        id: {
            type: String,
            required: false,
            default: '1'
        }
    },
    methods: {
        changeId() {
            const newId = this.id === '1' ? '2' : '1'
            this.$router.push(`/main/home/${newId}`)
        }
    }
}
</script>